package com.yan.test;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public abstract class Base<M> {

	Map<String, Object> map = new ConcurrentHashMap<String, Object>();

	@SuppressWarnings("unchecked")
	public M set(String param, Object value) {
		map.put(param, value);
		return (M) this;
	}

	@SuppressWarnings("unchecked")
	public M getObject(Object obj, String param) {
		if (obj.equals(Integer.class)) {
			Number n = (Number) map.get(param);
			return (M) (n != null ? n.intValue() : null);
		} else if (obj.equals(String.class)) {
			String strkey = (String) map.get(param);
			return (M) strkey;
		}
		return null;
	}

}
